import http from "@/api/config";
import { root } from "../config";
import utils from "@/utils/utils";

/**
 * 根据ID，获取广告信息
 * @param id
 * @param callback
 */
const login = (username, password, callback) => {
  var url = root + "/Users/login";

  let data = new FormData();
  data.append("username", username);
  data.append("password", utils.myMd5(password));

  http.post(url,data).then(res => {
    callback(res.data);
  });
};


/**
 * 注册
 * @param id
 * @param callback
 */
const zhuce = (mid,username, password, callback) => {
  var url = root + "/Users/zhuce";

  let data = new FormData();

  data.append("username", username);
  data.append("mid", mid);
  data.append("password", utils.myMd5(password));

  http.post(url,data).then(res => {
    callback(res.data);
  });
};

export { login, zhuce };
